package com.sunwayworld.basemodule.common.asynctask.resource;

import com.sunwayworld.basemodule.common.asynctask.bean.LimsAsynctaskBean;
import com.sunwayworld.basemodule.common.asynctask.bean.LimsAsynctaskScheduleBean;
import com.sunwayworld.basemodule.common.asynctask.bean.LimsAsynctaskServerBean;
import com.sunwayworld.basemodule.common.asynctask.service.LimsAsynctaskService;
import com.sunwayworld.basemodule.common.asynctask.statics.TaskStaticsInfo;
import com.sunwayworld.basemodule.common.asynctask.statics.TaskTypeExecuteInfo;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;
import com.sunwayworld.framework.support.base.resource.GenericResource;
import com.sunwayworld.framework.support.choosable.resource.GenericChoosableResource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;
import java.util.Map;

@RequestMapping("/secure/basemodule/common/asynctasks")
public interface LimsAsynctaskResource extends GenericResource<LimsAsynctaskService, LimsAsynctaskBean, Long>, GenericChoosableResource<LimsAsynctaskService, LimsAsynctaskBean, Long> {

    @Log(
            value = "手动新增任务",
            type = LogType.SELECT
    )
    @RequestMapping(
            value = {"/task/add"},
            method = {RequestMethod.POST}
    )
    Map<String,Object> addTask(RestJsonWrapperBean wrapperBean);

    @Log(
            value = "在当前节点测试任务",
            type = LogType.SELECT
    )
    @RequestMapping(
            value = {"/testTask"},
            method = {RequestMethod.POST}
    )
    Map<String,Object> testTask(RestJsonWrapperBean wrapperBean);


    @Log(
            value = "查询报告任务统计",
            type = LogType.SELECT
    )
    @RequestMapping(
            value = {"/queryTaskStaticsInfo"},
            method = {RequestMethod.GET}
    )
    TaskStaticsInfo queryTaskStaticsInfo();

    @Log(
            value = "查询统计,不同任务类型=x,不同状态的数量=y",
            type = LogType.SELECT
    )
    @RequestMapping(
            value = {"/queryTaskTypeExecuteInfo"},
            method = {RequestMethod.GET}
    )
    TaskTypeExecuteInfo queryTaskTypeExecuteInfo();

    @Log(
            value = "检测各异步服务节点健康",
            type = LogType.SELECT
    )
    @RequestMapping(
            value = {"/asyncServer/health"},
            method = {RequestMethod.POST}
    )
    List<LimsAsynctaskServerBean> asyncServerHealth();

}
